﻿<!DOCTYPE HTML>
<html>
{include file="public:header_css"}
<body>
<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页
	<span class="c-gray en">&gt;</span>
	系统管理
	<span class="c-gray en">&gt;</span>
	基本设置
	<a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a>
</nav>
<div class="page-container">
	<div class="form form-horizontal" id="form-article-add">
		<div id="tab-system" class="HuiTab">
			<div class="tabBar cl">
				<span>基本设置</span>
				<span>七牛存储</span>
				<span>微信设置</span>
				<span>微信支付</span>
			</div>

			<div class="tabCon">
				<div class="row cl">
					<label class="form-label col-xs-4 col-sm-2">
						<span class="c-red">*</span> 网站名称：
					</label>
					<div class="formControls col-xs-8 col-sm-9">
						<input type="text" id="website_title" placeholder="控制在25个字、50个字节以内" value="{$config.website_title}" class="input-text">
					</div>
				</div>
				<div class="row cl">
					<label class="form-label col-xs-4 col-sm-2">
						<span class="c-red">*</span> 关键词：
					</label>
					<div class="formControls col-xs-8 col-sm-9">
						<input type="text" id="keywords" placeholder="5个左右,8汉字以内,用英文,隔开" value="{$config.keywords}" class="input-text">
					</div>
				</div>
				<div class="row cl">
					<label class="form-label col-xs-4 col-sm-2">
						<span class="c-red">*</span> 描述：
					</label>
					<div class="formControls col-xs-8 col-sm-9">
						<textarea class="textarea" name="" id="description">{$config.description}</textarea>
					</div>
				</div>
				<div class="row cl">
					<label class="form-label col-xs-4 col-sm-2">
						<span class="c-red">*</span> 商户默认门店数：</label>
					<div class="formControls col-xs-8 col-sm-9">
						<input type="text" id="website-static" placeholder="默认门店可开门店数" value="{$config.max_store_num}" class="input-text" onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))" onkeyup="value='{$config.max_store_num}'">
					</div>
				</div>
				<div class="row cl">
					<label class="form-label col-xs-4 col-sm-2">
						<span class="c-red">*</span> 公告：</label>
					<div class="formControls col-xs-8 col-sm-9">
						<input type="text" id="notice" placeholder="站点公告" value="{$config.notice}" class="input-text">
					</div>
				</div>

				<br />
				<div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-2">
					<button onClick="base_save_submit();" class="btn btn-primary radius" type="submit"><i class="Hui-iconfont">&#xe632;</i> 保存</button>
					<button onClick="layer_close();" class="btn btn-default radius" type="button">&nbsp;&nbsp;取消&nbsp;&nbsp;</button>
				</div>

			</div>


			<div class="tabCon">
				<div class="row cl">
					<label class="form-label col-xs-4 col-sm-2">AK：</label>
					<div class="formControls col-xs-8 col-sm-9">
						<input type="text" class="input-text" value="{$config.qiniu.ak}" id="ak" name="ak" >
					</div>
				</div>
				<div class="row cl">
					<label class="form-label col-xs-4 col-sm-2">SK：</label>
					<div class="formControls col-xs-8 col-sm-9">
						<input type="text" class="input-text" value="{$config.qiniu.sk}" id="sk" name="sk" >
					</div>
				</div>
				<div class="row cl">
					<label class="form-label col-xs-4 col-sm-2">BK：</label>
					<div class="formControls col-xs-8 col-sm-9">
						<input type="text" class="input-text" value="{$config.qiniu.bk}" id="bk" name="bk" >
					</div>
				</div>
				<div class="row cl">
					<label class="form-label col-xs-4 col-sm-2">domain：</label>
					<div class="formControls col-xs-8 col-sm-9">
						<input type="text" class="input-text" value="{$config.qiniu.domain}" id="domain" name="domain" >
					</div>
				</div>

				<br />
				<div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-2">
					<button onClick="qiniu_save_submit();" class="btn btn-primary radius" type="submit"><i class="Hui-iconfont">&#xe632;</i> 保存</button>
					<button onClick="layer_close();" class="btn btn-default radius" type="button">&nbsp;&nbsp;取消&nbsp;&nbsp;</button>
				</div>

			</div>


			<div class="tabCon">
				<div class="row cl">
					<label class="form-label col-xs-4 col-sm-2">公众号名称：</label>
					<div class="formControls col-xs-8 col-sm-9">
						<input type="text"  class="input-text" value="{$config.wchat.wx_name}" id="wx_name" name="wx_name">
					</div>
				</div>
				<div class="row cl">
					<label class="form-label col-xs-4 col-sm-2">appid：</label>
					<div class="formControls col-xs-8 col-sm-9">
						<input type="text"  class="input-text" value="{$config.wchat.appid}" id="appid" name="appid">
					</div>
				</div>
				<div class="row cl">
					<label class="form-label col-xs-4 col-sm-2">appsecret：</label>
					<div class="formControls col-xs-8 col-sm-9">
						<input type="text" class="input-text" value="{$config.wchat.appsecret}" id="appsecret" name="appsecret">
					</div>
				</div>
				<div class="row cl">
					<label class="form-label col-xs-4 col-sm-2">URL：</label>
					<div class="formControls col-xs-8 col-sm-9">
						<input type="text" class="input-text" value="{$config.wchat.url}" id="url" name="url" >
					</div>
				</div>
				<div class="row cl">
					<label class="form-label col-xs-4 col-sm-2">token：</label>
					<div class="formControls col-xs-8 col-sm-9">
						<input type="text" class="input-text" value="{$config.wchat.token}" id="token" name="token" >
					</div>
				</div>

				<br />
				<div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-2">
					<button onClick="wchat_save_submit();" class="btn btn-primary radius" type="submit"><i class="Hui-iconfont">&#xe632;</i> 保存</button>
					<button onClick="layer_close();" class="btn btn-default radius" type="button">&nbsp;&nbsp;取消&nbsp;&nbsp;</button>
				</div>

			</div>


			<div class="tabCon">
				<div class="row cl">
					<label class="form-label col-xs-4 col-sm-2">appid：</label>
					<div class="formControls col-xs-8 col-sm-9">
						<input type="text"  class="input-text" value="{$config.wxpay.appid}" id="wx_appid" name="wx_appid">
					</div>
				</div>
				<div class="row cl">
					<label class="form-label col-xs-4 col-sm-2">appsecret：</label>
					<div class="formControls col-xs-8 col-sm-9">
						<input type="text" class="input-text" value="{$config.wxpay.appsecret}" id="wx_appsecret" name="wx_appsecret">
					</div>
				</div>
				<div class="row cl">
					<label class="form-label col-xs-4 col-sm-2">key：</label>
					<div class="formControls col-xs-8 col-sm-9">
						<input type="text" class="input-text" value="{$config.wxpay.key}" id="key" name="key" >
					</div>
				</div>
				<div class="row cl">
					<label class="form-label col-xs-4 col-sm-2">back_url：</label>
					<div class="formControls col-xs-8 col-sm-9">
						<input type="text" class="input-text" value="{$config.wxpay.back_url}" id="back_url" name="back_url" >
					</div>
				</div>

				<br />
				<div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-2">
					<button onClick="wxpay_save_submit();" class="btn btn-primary radius" type="submit"><i class="Hui-iconfont">&#xe632;</i> 保存</button>
					<button onClick="layer_close();" class="btn btn-default radius" type="button">&nbsp;&nbsp;取消&nbsp;&nbsp;</button>
				</div>

			</div>

		</div>
	</div>
</div>

{include file="public:footer_js"}

<script type="text/javascript" src="__STATIC__/admin/lib/layer/2.4/layer.js"></script>

<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript" src="__STATIC__/admin/lib/My97DatePicker/4.8/WdatePicker.js"></script>
<script type="text/javascript" src="__STATIC__/admin/lib/jquery.validation/1.14.0/jquery.validate.js"></script>
<script type="text/javascript" src="__STATIC__/admin/lib/jquery.validation/1.14.0/validate-methods.js"></script>
<script type="text/javascript" src="__STATIC__/admin/lib/jquery.validation/1.14.0/messages_zh.js"></script>
<script type="text/javascript">
    $(function(){
        $('.skin-minimal input').iCheck({
            checkboxClass: 'icheckbox-blue',
            radioClass: 'iradio-blue',
            increaseArea: '20%'
        });
        $("#tab-system").Huitab({
            index:0
        });
    });

    /**
	 * 修改基础设置
	 */
	function base_save_submit()
	{
		var website_title 	= $("#website_title").val();
		var keywords 		= $("#keywords").val();
		var description 	= $("#description").val();
		var max_store_num 	= $("#max_store_num").val();
		var notice 			= $("#notice").val();

		$.post(
		    '{:url("saveBase")}',
			{
                website_title:website_title,
                keywords:keywords,
                description:description,
                max_store_num:max_store_num,
                notice:notice
			},
			function (res) {

                // 弹出信息
                layer.msg('更新成功',{icon:6,time:1000});

                // 页面刷新
                setTimeout(
                    // 跳转至管理后台首页
                    function(){
                        location.replace(location.href);
                    },
                    2000
                );

            }
		);
    }

    /**
	 * 修改七牛配置
	 */
    function qiniu_save_submit()
	{
        var ak 		= $("#ak").val();
        var sk 		= $("#sk").val();
        var bk 		= $("#bk").val();
        var domain 	= $("#domain").val();

        $.post(
            '{:url("saveQiniu")}',
			{
                ak:ak,
                sk:sk,
                bk:bk,
				domain:domain
			},
			function (res) {
                if(res.code === 1){
                    // 弹出信息
                    layer.msg(res.msg,{icon:6,time:1000});

                    // 页面刷新
                    setTimeout(
                        // 跳转至管理后台首页
                        function(){
                            location.replace(location.href);
                        },
                        2000
                    );

				}else{
                    layer.msg(res.msg,{icon:5,time:1000});
				}

            }
		);
	}


	/**
	 * 微信服务器配置
	 */
	function wchat_save_submit() {
        var appid 		= $("#appid").val();
        var appsecret 	= $("#appsecret").val();
        var url 		= $("#url").val();
        var token 		= $("#token").val();
        var wx_name 	= $("#wx_name").val();

        $.post(
            '{:url("saveWchat")}',
            {
                appid:appid,
                appsecret:appsecret,
                url:url,
                token:token,
                wx_name:wx_name
            },
            function (res) {
                if(res.code === 1){
                    // 弹出信息
                    layer.msg(res.msg,{icon:6,time:1000});

                    // 页面刷新
                    setTimeout(
                        // 跳转至管理后台首页
                        function(){
                            location.replace(location.href);
                        },
                        2000
                    );

                }else{
                    layer.msg(res.msg,{icon:5,time:1000});
                }

            }
        );
    }


    /**
     * 微信支付配置
     */
    function wxpay_save_submit() {
        var wx_appid 		= $("#wx_appid").val();
        var wx_appsecret 	= $("#wx_appsecret").val();
        var back_url		= $("#back_url").val();
        var key 			= $("#key").val();

        $.post(
            '{:url("saveWxPay")}',
            {
                appid:wx_appid,
                appsecret:wx_appsecret,
                back_url:back_url,
                key:key
            },
            function (res) {
                if(res.code === 1){
                    // 弹出信息
                    layer.msg(res.msg,{icon:6,time:1000});

                    // 页面刷新
                    setTimeout(
                        // 跳转至管理后台首页
                        function(){
                            location.replace(location.href);
                        },
                        2000
                    );

                }else{
                    layer.msg(res.msg,{icon:5,time:1000});
                }

            }
        );
    }

</script>
<!--/请在上方写此页面业务相关的脚本-->
</body>
</html>
</html>